@use '../core' as *;

.cta {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: $spacing-size-10;
    height: $spacing-size-10;
    border-radius: var(--radius-sm);
    transition:
        color $transition-default-timing,
        background-color $transition-default-timing;
    cursor: pointer;

    &:hover {
        background-color: var(--color-util-brand-100);
    }

    svg {
        --icon-size: 1.25em;

        fill: var(--color-link);
        transform: translate(1px, 0.75px);
        transition: fill $transition-default-timing;
    }

    li:first-child & svg {
        --icon-size: 1.35em;
    }

    #{$selector-darkmode} & {
        &:hover {
            background-color: var(--color-util-brand-50);
        }
    }
}

.tooltip {
    --tooltip-background: var(--color-fg-primary);

    position: absolute;
    display: block;
    color: var(--color-bg-primary);
    top: -44px;
    padding: $spacing-size-1 $spacing-size-4;
    white-space: nowrap;
    font-weight: 600;
    background-color: var(--tooltip-background);
    border-radius: 6px;
    transform: translateY($spacing-size-1);
    opacity: 0;
    pointer-events: none;
    transition-delay: 0;
    transition:
        opacity 0.165s ease-in,
        transform 0.165s ease-in;
    z-index: 1;

    &::before {
        $pointer-size: 8px;

        content: '';
        position: absolute;
        background-color: var(--tooltip-background);
        width: $pointer-size * 2;
        height: $pointer-size * 2;
        transform: rotate(45deg);
        bottom: -7px;
        left: calc(50% - $pointer-size);
        border-radius: 3px;
        z-index: -1;
    }

    .cta:hover & {
        opacity: 1;
        transform: translateY(0);
        transition:
            opacity 0.33s ease-in,
            transform 0.33s ease-in;
        transition-delay: 0.165s;
    }

    #{$selector-darkmode} & {
        --tooltip-background: var(--color-bg-secondary);

        color: var(--color-fg-primary);
        box-shadow: 0 -4px 16px 0 rgba(0, 0, 0, 0.4);
    }
}
